Skip to content

feat(android): detect built-in Kotlin instead of checking the AGP version - #18355

Open
SelaseKay wants to merge 1 commit into
mainfrom
agp9-built-in-kotlin-migration
Open

SelaseKay wants to merge 1 commit into
mainfrom
agp9-built-in-kotlin-migration

Conversation

@SelaseKay

@SelaseKay SelaseKay commented Jun 8, 2026 •

Copy link
Copy Markdown
Contributor

Description

The built-in Kotlin migration in #18922 sets each plugin's Kotlin JVM target in one of two ways. When built-in Kotlin is on, AGP has already registered the kotlin extension and the target is set on it. When built-in Kotlin is off, Flutter applies org.jetbrains.kotlin.android after the plugin script, and the target is set then.

That choice was made by reading the AGP major version. This pull request drops the version check. If the kotlin extension is already registered, the target is set immediately. If it is not, the existing plugins.withId path still runs. Apps that leave android.builtInKotlin off keep configuring, including Flutter 3.44 through 3.46, where turning built-in Kotlin on is not supported.

#18355 removed that branch outright. Replaying it on current main fails configuration whenever android.builtInKotlin is false, which is still the setting in these examples and in the Flutter template. The version check is what this rebase removes. The fallback stays.

AGP 9.3.1, Gradle 9.5.0, Kotlin 2.4.20, and the Flutter 3.44 / Dart 3.12 floor are unchanged.

Related Issues

Rebases #18355 onto current main after #18922.

Related: #18944

Checklist

Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes ([x]).
This will ensure a smooth and quick review process. Updating the pubspec.yaml and changelogs is not required.

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • My PR includes unit or integration tests for all changed/updated/fixed behaviors (See Contributor Guide).
  • All existing and new tests are passing.
  • I updated/added relevant documentation (doc comments with ///).
  • The analyzer (melos run analyze) does not report any problems on my PR.
  • I read and followed the Flutter Style Guide.
  • I signed the CLA.
  • I am willing to follow-up on review comments in a timely manner.

Breaking Change

Does your PR require plugin users to manually update their apps to accommodate your change?

  • Yes, this is a breaking change.
  • No, this is not a breaking change.

Apps that set android.builtInKotlin=false, and apps on AGP older than 9, still take the plugins.withId path. No Gradle files in an app have to change.

Test plan

  • CI is green.
  • One example configures with android.builtInKotlin=true and the plugin's JVM target matches its Java version. Examples and tests/android stay on false, so CI only exercises the fallback.

@gemini-code-assist

Copy link
Copy Markdown
Contributor
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

@SelaseKay
SelaseKay marked this pull request as ready for review June 9, 2026 14:09
@SelaseKay SelaseKay added the blocked: do-not-merge PR blocked externally label Jul 6, 2026
@wiz-9635d3485b

wiz-9635d3485b Bot commented Jul 6, 2026 •

Copy link
Copy Markdown

Wiz Scan Summary

Scanner Findings
Vulnerability Finding Vulnerabilities -
Data Finding Sensitive Data -
Secret Finding Secrets -
IaC Misconfiguration IaC Misconfigurations -
SAST Finding SAST Findings -
Software Management Finding Software Management Findings -
Total -

View scan details in Wiz

To detect these findings earlier in the dev lifecycle, try the Wiz Code extension for VS Code, JetBrains, or Visual Studio.

@JisoDev

JisoDev commented Oct 14, 2026

Copy link
Copy Markdown

@SelaseKay Sorry for the duplicated PR, can you explain why this one is stale ?

@M1tiens

M1tiens commented Oct 14, 2026

Copy link
Copy Markdown

What's delaying this pr?

@realdev-fr

Copy link
Copy Markdown

Hi,
Any update here ?

…sion

The JVM target was chosen by comparing the AGP major version and the
android.builtInKotlin flag. AGP registers the kotlin extension when
built-in Kotlin is on, so use that. When the extension is absent,
Flutter still applies the Kotlin plugin after this script, and the
target is set then. Apps that leave built-in Kotlin off, including
Flutter 3.44 through 3.46, keep configuring.
@SelaseKay
SelaseKay force-pushed the agp9-built-in-kotlin-migration branch from e373a8c to bfcaf71 Compare November 13, 2026 11:40
@SelaseKay SelaseKay changed the title feat(android): Built-in Kotlin migration feat(android): detect built-in Kotlin instead of checking the AGP version Nov 13, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

blocked: do-not-merge PR blocked externally

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants